/* popup.css - Styles for the popup interface */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background-color: #ffffff;
    color: #1e293b;
    width: 100%;
    height: 100vh;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

.container {
    padding: 12px;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    background: transparent;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.icon {
    font-size: 18px;
}

/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.tab-btn:hover {
    color: #3b82f6;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Bar */
.search-bar {
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Rules List */
.rules-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.rule-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.rule-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.rule-name {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
}

.rule-actions {
    display: flex;
    gap: 8px;
}

.rule-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.rule-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-method {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-enabled {
    background-color: #dcfce7;
    color: #166534;
}

.badge-disabled {
    background-color: #fef2f2;
    color: #991b1b;
}

.rule-url {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
    color: #6b7280;
    background-color: #f9fafb;
    padding: 4px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #3b82f6;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #374151;
}

/* Logs */
.logs-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.logs-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.log-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 12px;
}

.log-url {
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 4px;
}

.log-time {
    color: #64748b;
    font-size: 11px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 20px auto;
    border-radius: 8px;
    width: 80%;
    max-width: none;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    background-color: #f1f5f9;
}

.modal-body {
    padding: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
    font-family: 'Monaco', 'Consolas', monospace;
}

/* 特殊样式：响应体JSON输入框使用更大的高度 */
.large-textarea {
    min-height: 200px !important;
    max-height: 400px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #374151;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
}

.modification-section {
    display: none;
    margin-left: 24px;
}

.modification-section.active {
    display: block;
}

/* API Selector Styles */
.api-selector-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.api-selector-container select {
    flex: 1;
}

.api-info-section {
    margin-bottom: 20px;
    padding: 16px;
    background-color: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.api-info h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.api-method-url {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.api-method {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    background-color: #dbeafe;
    color: #1e40af;
    min-width: 60px;
    text-align: center;
}

.api-method.POST { background-color: #dcfce7; color: #166534; }
.api-method.PUT { background-color: #fef3c7; color: #92400e; }
.api-method.DELETE { background-color: #fecaca; color: #991b1b; }
.api-method.PATCH { background-color: #e0e7ff; color: #3730a3; }

.api-url {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: #374151;
    word-break: break-all;
    flex: 1;
}

.api-details {
    border-left: 3px solid #3b82f6;
    padding-left: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* DevTools Panel specific adjustments */
.modal {
    position: fixed;
    z-index: 10000;
}

.modal-content {
    max-height: 90vh;
}